﻿using Microsoft.VisualStudio.Modeling.Diagrams;
namespace DSLFactory.VSCTDesigner
{
    partial class VSCTDesignerCommandSet
    {

        partial class AddKeyBindingCommand
        {
            protected override void Execute()
            {
                NodeShape shape = this.CommandSet.SingleSelection as NodeShape;
                if( shape != null )
                {
                    Command cmd = shape.Subject as Command;
                    if( cmd != null )
                        cmd.AddKeyBinding();
                }
            }

            protected override void OnQueryStatus(System.EventArgs e)
            {
                NodeShape shape = this.CommandSet.SingleSelection as NodeShape;
                bool flag = false;
                if( shape != null )
                {
                    Command cmd = shape.Subject as Command;
                    flag = cmd != null && cmd.CanAddKeyBinding;
                }
                this.Enabled = this.Visible = flag;
            }
        }
    }
}